package com.example.common.exception;


import com.example.common.dto.JsonResult;

/**
 * 业务异常类
 */
public class BusinessException extends RuntimeException {

    private String code;

    public BusinessException(String message) {
        super(message);
        this.code = JsonResult.CODE_ERROR;
    }

    public BusinessException(String code, String message) {
        super(message);

        if (JsonResult.CODE_SUCCESS.equals(code)) {
            throw new IllegalArgumentException();
        }

        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
